@extends('admin::layouts.master')
@section('title')
    年检须知列表
@endsection
@section('tab')
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body ">
                        <a class="layui-btn" onclick="location.reload()">
                            <i class="layui-icon layui-icon-refresh"></i>
                        </a>
                    </div>

                    <div class="layui-card-body">


                    </div>
                    <div class="layui-card-body layui_overflow_y">

                        <table class="layui-table layui-form">
                            <tr>
                                <th class="th_gray">所需材料</th>
                                <th class="th_gray" colspan="3">
                                    <button class="layui-btn layui-btn-normal" onclick="xadmin.open('添加所需材料','{{route("admin_year_check_notice_create",['cate'=>1])}}',800,600)"><i class="layui-icon"></i>添加</button>
                                </th>
                            </tr>
                            <tr>
                                <th>序号</th>
                                <th>内容</th>
                                <th>排序</th>
                                <th>操作</th>
                            </tr>

                            @foreach($data['needed_material'] as $key=>$value)
                                <tr>
                                    <td>{{$key+1}}</td>
                                    <td>{{$value['name']}}</td>
                                    <td>{{$value['sort']}}</td>

                                    <td class="td-manage">
                                        <button class="layui-btn layui-btn layui-btn-xs"  onclick="xadmin.open('修改年检须知','{{route("admin_year_check_notice_edit",["id"=>$value["id"]])}}')" ><i class="layui-icon">&#xe642;</i>修改</button>
                                        <button class="layui-btn-danger layui-btn layui-btn-xs ajax_member_del" data-href="{{route('admin_year_check_notice_delete',['id'=>$value['id']])}}" data-title="确定删除年检须知吗？请谨慎操作" href="javascript:;" ><i class="layui-icon">&#xe640;</i>删除</button>
                                    </td>
                                </tr>

                            @endforeach

                            @if(count($data['needed_material']) == 0)
                                <tr><td colspan="4" style="text-align: center">暂无数据</td></tr>
                            @endif
                            <tr>
                                <td colspan="4"></td>
                            </tr>

                            <tr>
                                <th class="th_gray">年检流程</th>
                                <th class="th_gray" colspan="3">
                                    <button class="layui-btn layui-btn-normal" onclick="xadmin.open('添加年检流程','{{route("admin_year_check_notice_create",['cate'=>2])}}',800,600)"><i class="layui-icon"></i>添加</button>
                                </th>
                            </tr>
                            <tr>
                                <th>序号</th>
                                <th>内容</th>
                                <th>排序</th>
                                <th>操作</th>
                            </tr>

                            @foreach($data['check_process'] as $key=>$value)
                                <tr>
                                    <td>{{$key+1}}</td>
                                    <td>{{$value['name']}}</td>
                                    <td>{{$value['sort']}}</td>

                                    <td class="td-manage">
                                        <button class="layui-btn layui-btn layui-btn-xs"  onclick="xadmin.open('修改年检须知','{{route("admin_year_check_notice_edit",["id"=>$value["id"]])}}')" ><i class="layui-icon">&#xe642;</i>修改</button>
                                        <button class="layui-btn-danger layui-btn layui-btn-xs ajax_member_del" data-href="{{route('admin_year_check_notice_delete',['id'=>$value['id']])}}" data-title="确定删除年检须知吗？请谨慎操作" href="javascript:;" ><i class="layui-icon">&#xe640;</i>删除</button>
                                    </td>
                                </tr>

                            @endforeach

                            @if(count($data['check_process']) == 0)
                                <tr><td colspan="4" style="text-align: center">暂无数据</td></tr>
                            @endif
                            <tr>
                                <td colspan="4"></td>
                            </tr>


                                <th class="th_gray">注意事项</th>
                                <th class="th_gray" colspan="3">
                                    <button class="layui-btn layui-btn-normal" onclick="xadmin.open('添加注意事项','{{route("admin_year_check_notice_create",['cate'=>3])}}',800,600)"><i class="layui-icon"></i>添加</button>
                                </th>
                            </tr>
                            <tr>
                                <th>序号</th>
                                <th>内容</th>
                                <th>排序</th>
                                <th>操作</th>
                            </tr>

                            @foreach($data['note_tips'] as $key=>$value)
                                <tr>
                                    <td>{{$key+1}}</td>
                                    <td>{{$value['name']}}</td>
                                    <td>{{$value['sort']}}</td>

                                    <td class="td-manage">
                                        <button class="layui-btn layui-btn layui-btn-xs"  onclick="xadmin.open('修改年检须知','{{route("admin_year_check_notice_edit",["id"=>$value["id"]])}}')" ><i class="layui-icon">&#xe642;</i>修改</button>
                                        <button class="layui-btn-danger layui-btn layui-btn-xs ajax_member_del" data-href="{{route('admin_year_check_notice_delete',['id'=>$value['id']])}}" data-title="确定删除年检须知吗？请谨慎操作" href="javascript:;" ><i class="layui-icon">&#xe640;</i>删除</button>
                                    </td>
                                </tr>

                            @endforeach

                            @if(count($data['note_tips']) == 0)
                                <tr><td colspan="4" style="text-align: center">暂无数据</td></tr>
                            @endif
                            <tr>
                                <td colspan="4"></td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('tab_js')
    <script>
        layui.use(['form'], function(){
            var form = layui.form;

            //监听指定开关-修改状态
            form.on('switch(change_state)',
                function(obj){
                    change_state(this);
                    // layer.msg('开关checked：'+ (this.checked ? 'true' : 'false'), {
                    //     offset: '60px'
                    // });
                    // layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', obj.othis)
                });

            //监听搜索
            form.on('submit(sreach)',
                function(data) {
                    var $_url = full_url('{{route('admin_year_check_notice')}}',data.field);
                    location_redirect($_url)
                });
        });
    </script>
@endsection




